﻿// -------------------------------------------------------------------------
//    @FileName         :    NFTitleUtil.cpp
//    @Author           :    Gao.Yi
//    @Date             :    2025-09-11
//    @Email			:    445267987@qq.com
//    @Module           :    NFTitleUtil
//    @Desc             :
//
// -------------------------------------------------------------------------

#include "NFTitleUtil.h"

#include "DescStore/TitleDesc.h"
#include "NFSnsPart.h"
#include "NFPlayer.h"

std::string NFTitleUtil::GetTitleName(NFPlayer* pPlayer, int titleId)
{
    std::string name;
    CHECK_NULL_RET_VAL(0, pPlayer, name);
    auto pDesc = TitleDesc::Instance()->GetDesc(titleId);
    CHECK_NULL_RET_VAL(0, pDesc, name);
    name = pDesc->name.ToString();

    auto pSnsPart = pPlayer->GetPart<NFSnsPart>();
    CHECK_NULL_RET_VAL(0, pDesc, name);

    /*switch(pDesc->type)
    {
        case proto_ff::EN_TITLE_TYPE_GUILD_JOB:
        {
            if(pSnsPart->IsInGuild())
            {
                std::string tmpName = pSnsPart->GetGuildName();
                tmpName += NFPlayerUtil::GetGuildJobName(pSnsPart->GetGuildTitle());
                name = tmpName;
            }

            break;
        }
        case proto_ff::EN_TITLE_TYPE_MASTER:
        {
            break;
        }
        case proto_ff::EN_TITLE_TYPE_APPRENTICE:
        {
            break;
        }
        case proto_ff::EN_TITLE_TYPE_FAMILY:
        {
            name = pSnsPart->GetData()->family_data.family_title.firstname;
            name += initTitleName[pSnsPart->GetData()->family_data.mem_id_size - 1];
            name += pSnsPart->GetData()->family_data.family_title.lastname;
            name += "·";
            name += pSnsPart->GetData()->family_data.memo_name;

            break;
        }
        default:
        {
            name = pDesc->name;
            break;
        }
    }*/
    return name;
}
